package com.ubb.damate.service.impl;

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import com.ubb.damate.model.Role;
import com.ubb.damate.service.RoleServiceLocal;
import com.ubb.damate.service.RoleServiceRemote;

/**
 * Session Bean implementation class RoleService
 */
@Stateless
public class RoleService implements RoleServiceRemote, RoleServiceLocal {

	@PersistenceContext(unitName = "damate-pu")
	private EntityManager em;

	@Override
	public Role createOrUpdate(Role role) {
		return em.merge(role);
	}

	@Override
	public void delete(Role role) {
		 em.remove(em.merge(role));
	}

	@Override
	public Role find(Role role) {
		return em.find(com.ubb.damate.model.Role.class, role);
	}

}